<template>
    <div class="box">
        <backcon></backcon>
        <div>
            <video autoplay controls>
                <source :src="arr.playURL" type="video/mp4"> 
            </video>
            <p class="title">{{arr.shareTitle}}</p>
        </div>
        <div v-for="(v,i) in introduces" :key="i" >
            <div>
                <p class="indroduce">【{{v.title}}】</p>
                <div v-html="v.introduce">{{v.introduce}}</div>
            </div>
            
        </div>
    </div>
</template>
<script>
import backcon from '../../backcon.vue'
export default {
    components:{backcon},
    data() {
        return {
            courseId:0,
            arr:[],
            introduces:[]
        }
    },
    watch: {
    // 监测路由变化,只要变化了就调用获取路由参数方法将数据存储本组件即可
    '$route': 'getParams'
    },
    created(){
         this.getParams();
         this.xiangqing()
    },
    activated:function(){
    this.getParams();
    this.xiangqing();
    },
    methods:{
        xiangqing:function(){
            this.axios({
                url:"https://api.hongbeibang.com/education/getCourse?_t=1585396271169&csrfToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOjAsImV4cCI6MTc3MTU2NjMxNCwiaWF0IjoxNTgyMTc3NTE0fQ.iBmGtQ0fasTTaSuApywmN6Ms0aNYwUvkGLoXX6V6hO8",
                method:"get",
                params: {
                   educationCourseId:this.courseId
                }
            }).then((ok)=>{
                this.arr=ok.data.data
                this.introduces=this.arr.introduces
                //window.console.log(this.arr)
                //window.console.log(this.introduces)
            })
        },
         getParams:function(){
            // 取到路由带过来的参数
            var courseId= this.$route.query.educationCourseId;
            // 将数据放在当前组件的数据内
            this.courseId = courseId
           // window.console.log(this.courseId)
      },
    }
}
</script>
<style scoped>
video{width: 100%}
.box{width: 90%;margin: .2rem auto;overflow: hidden}
.indroduce,.title{font-weight: bold;font-size: .2rem}
.title{margin: .06rem 0}
</style>